import request from '@/utils/request'
import getUserProfileName from "@/utils/getUserProfile"

// 查询今日销售总金额，总升数
export function listSum(query) {
  return request({
    url: '/station/historyOrder/selectDaySources',
    method: 'get',
    params: query
  })
}

// 查询今日销售总金额，总升数包括已经作废的订单
export async function listAllSum(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
    const isDelete = await getUserProfileName()
    let queryPlass
    if(isDelete){ 
      queryPlass = query
    } else {
      queryPlass = {...query, isDeleted:0}
    }

  return request({
    url: '/station/historyOrder/selectAllDaySources',
    method: 'get',
    params: queryPlass
  })
}



// 查询到款金额和充值金额
export function listReceiveAmt(query) {
  return request({
    url: '/station/historyOrder/selectReceiveDaySources',
    method: 'get',
    params: query
  })
}

//根据油品查询总的金额
export function listOilType(query) {
  return request({
    url: '/station/historyOrder/selectOilTypeSources',
    method: 'get',
    params: query
  })
}
//根据油品查询总的金额（包括退款的信息）
export async function listAllOilType(query) {
   // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
   const isDelete = await getUserProfileName()
   let queryPlass
   if(isDelete){ 
      queryPlass = query
   } else {
      queryPlass = {...query, isDeleted:0}
   }

  return request({
    url: '/station/historyOrder/selectAllOilTypeSources',
    method: 'get',
    params: queryPlass
  })
}

//查询收入的金额展示
export function listViewData(query) {
  return request({
    url: '/station/historyOrder/selectOverViewData',
    method: 'get',
    params: query
  })
}
//查询收入的金额展示（包括退款）
export function listAllViewData(query) {
  return request({
    url: '/station/historyOrder/selectAllOverViewData',
    method: 'get',
    params: query
  })
}

// 查询订单支付详细
export function getOrder(orderId) {
  return request({
    url: '/station/historyOrder/' + orderId,
    method: 'get'
  })
}

export function listDayReport(query) {
  return request({
    url: '/station/historyOrder/selectDayReport',
    method: 'get',
    params: query
  })
}
//查询本月的消费情况
export function selectDayReportDetail(query) {
  return request({
    url: '/station/historyOrder/selectDayReportDetail',
    method: 'get',
    params: query
  })
}
//查询本月的消费情况（包括已经退款的）
export async function selectAllDayReportDetail(query) {
  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName()
  let queryPlass
  if(isDelete){ 
    queryPlass = query
  } else {
    queryPlass = {...query, isDeleted:0}
  }

  return request({
    url: '/station/historyOrder/selectAllDayReportDetail',
    method: 'get',
    params: queryPlass
  })
}

//查询本天的消费情况
export async function getDetails(query) {

  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName()
  let queryPlass
  if(isDelete){ 
    queryPlass = query
  } else {
    queryPlass = {...query, isDeleted:0}
  }

  return request({
    url: '/station/historyOrder/dayOilTypeSources',
    method: 'get',
    params: queryPlass
  })
}
//查询本天的消费情况（包括已经退款的）
export async function getAllDetails(query) {

  // 判断是否的admin 账号，如果不是，传 isDelete = 0 到后端，如果是则不用传参
  const isDelete = await getUserProfileName()
  let queryPlass
  if(isDelete){ 
    queryPlass = query
  } else {
    queryPlass = {...query, isDeleted:0}
  }

  return request({
    url: '/station/historyOrder/dayAllOilTypeSources',
    method: 'get',
    params: queryPlass
  })
}
export function listQydata92(query) {
  return request({
    url: '/station/historyOrder/listQydata92',
    method: 'get',
    params: query
  })
}
export function listQydata95(query) {
  return request({
    url: '/station/historyOrder/listQydata95',
    method: 'get',
    params: query
  })
}
export function listQydata98(query) {
  return request({
    url: '/station/historyOrder/listQydata98',
    method: 'get',
    params: query
  })
}
export function listQydata0(query) {
  return request({
    url: '/station/historyOrder/listQydata0',
    method: 'get',
    params: query
  })
}
export function listQydata10(query) {
  return request({
    url: '/station/historyOrder/listQydata10',
    method: 'get',
    params: query
  })
}
export function listQydata20(query) {
  return request({
    url: '/station/historyOrder/listQydata20',
    method: 'get',
    params: query
  })
}
export function listXdata(query) {
  return request({
    url: '/station/historyOrder/listXdata',
    method: 'get',
    params: query
  })
}
//累计充值
export function listCZXFData(query) {
  return request({
    url: '/customer/record/listCZXFData',
    method: 'get',
    params: query
  })
}
//累计充值（包含退款金额）
export function listAllCZXFData(query) {
  return request({
    url: '/customer/record/listAllCZXFData',
    method: 'get',
    params: query
  })
}
//汇总电子卡
export function listHYData(query) {
  return request({
    url: '/customer/card/listHYData',
    method: 'get',
    params: query
  })
}


export function listJRHYData(query) {
  return request({
    url: '/customer/card/listJRHYData',
    method: 'get',
    params: query
  })
}

